/**
 * @author renato
 * Created on 03/11/2005
 * Updated on 02/04/2010
 */
package br.unb.data;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class FileData implements DataGenerator {

    private FileInputStream fis;

    /**
     * Builds a data generator which the source comes from a file
     * @param file
     */
    public FileData(File file) {
        try {
            fis = new FileInputStream(file);
        } catch (IOException ioe) {
        }
    }

    public int getNextData(byte[] data, int len) {
        try {
            return fis.read(data, 0, len);

        } catch (IOException ioe) {
        }
        return -1;
    }
}
